import { login,
    logout,
    register,
    getMessageConfig,
    modifyMessageConfig,
    modifyEmail,
    modifyPassword,
    getUserInfo,
    updateUserInfo,
    userBalance,
    rechargeRecord,
    expenseRecord,
    recharge,
    transferVerificationCode,
    applyTransfer,
    whetherTransfer,
    getBoughtCourseList,
    getUserCompetitonList,
    getDataList,
    getProjectList,
    quotaCheck,
    projectView,
    projectShare,
    projectRelease,
    projectDelete
 } from '../../api/user'

export default {
    state:{
        balance:"",
    },
    mutations:{
        BALANCE:(state,params) => {
            state.balance = params
        },
    },
    actions:{
        Xlogin(context,params){
            return login(params)
        },
        Xregister(context,params){
            return register(params)
        },
        Xlogout(context,params){
            return logout(params)
        },
        // 账号设置
        XgetMessageConfig(context,params){
            return getMessageConfig(params)
        },
        XmodifyMessageConfig(context,params){
            return modifyMessageConfig(params)
        },
        XmodifyEmail(context,params){
            return modifyEmail(params)
        },
        XmodifyPassword(context,params){
            return modifyPassword(params)
        },
        // 账户余额
        XuserBalance(context,params){
            return userBalance(params).then(res => {
                context.commit("BALANCE",res.data.coinCnt)
            })
        },
        XrechargeRecord(context,params){
            return rechargeRecord(params)
        },
        XexpenseRecord(context,params){
            return expenseRecord(params)
        },
        Xrecharge(context,params){
            return recharge(params)
        },
        XtransferVerificationCode(context,params){
            return transferVerificationCode(params)
        },
        XapplyTransfer(context,params){
            return applyTransfer(params)
        },
        XwhetherTransfer(context,params){
            return whetherTransfer(params)
        },
        // 个人信息
        XgetUserInfo(context,params){
            return getUserInfo(params)
        },
        XupdateUserInfo(context,params){
            return updateUserInfo(params)
        },
        // 我的课程
        XgetBoughtCourseList(context,params){
            return getBoughtCourseList(params)
        },
        // 我的项目
        XgetProjectList(context,params){
            return getProjectList(params)
        },
        XquotaCheck(context,params){
            return quotaCheck(params)
        },
        XprojectView(context,params){
            return projectView(params)
        },
        XprojectShare(context,params){
            return projectShare(params)
        },
        XprojectRelease(context,params){
            return projectRelease(params)
        },
        XprojectDelete(context,params){
            return projectDelete(params)
        },

        // 竞赛活动
        XgetUserCompetitonList(context,params){
            return getUserCompetitonList(params)
        },
        // 数据集
        XgetDataList(context,params){
            return getDataList(params)
        },
    }
}